#include<iostream>
#include<cstring>
using namespace std;
const int N = 115, INF = 0x3f3f3f3f;
int c, n, m;
int cnt;
int mp[N][N];	
int dis[N];
bool st[N];
int Prim()
{
	memset(dis, 0x3f, sizeof(dis));
	dis[1] = 0;
	int res = 0;
	for (int i = 0; i < n; i++) {
		int t = -1;
		for (int j = 1; j <= n; j++) {
			if (!st[j] && (t == -1 || dis[t] > dis[j])) {
				t = j;
			}
		}
		if (i && dis[t] == INF) {
			return -1;
		}
		if (i) {
			res += dis[t];
		}
		st[t] = 1;
		for (int j = 1; j <= n; j++) {
			dis[j] = min(dis[j], mp[t][j]);
		}
	}
	return res;
}
int main()
{
	while (cin >> c >> n >> m) {
		memset(st, 0, sizeof(st));
		memset(mp, 0, sizeof(mp));
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				mp[i][j] = 0;
			}
		}
		for (int i = 0; i < n; i++) {
			int a, b, w;
			cin >> a >> b >> w;
			mp[a][b] = min(mp[a][b], w);
		}
		int ret = Prim();
		if (ret == -1 || ret > c) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}
	
	return 0;
}